<?php
class Request extends Base {
	
  	public function __construct($vars=null) {
		if($vars->clean) {
			$_GET = $this->Clean($_GET);
			$_POST = $this->Clean($_POST);
			$_REQUEST = $this->Clean($_REQUEST);
			$_COOKIE = $this->Clean($_COOKIE);
			$_SESSION = $this->Clean($_SESSION);
			$_FILES = $this->Clean($_FILES);
			$_SERVER = $this->Clean($_SERVER);
		}
		$this->get = $this->GET = $_GET;
		$this->post = $this->POST = $_POST;
		$this->session = $this->SESSION = $_SESSION;
		$this->request = $this->REQUEST = $_REQUEST;
		$this->cookie = $this->COOKIE = $_COOKIE;
		$this->files = $this->FILES = $_FILES;
		$this->server =$this->SERVER = $_SERVER;
	}
	
  	public static function Clean($data) {
    	if (is_array($data)) {
	  		foreach ($data as $key => $value) {
				unset($data[$key]);
				
	    		$data[self::Clean($key)] = self::Clean($value);
	  		}
		} else { 
	  		$data = htmlspecialchars($data, ENT_COMPAT);
		}

		return $data;
	}
}
?>
